﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Month.aspx.cs" Inherits="JsonServer.Month" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body style="height: 2501px; width: 302px">
    <form id="form1" runat="server" style="background-color: #00FFFF; width: 308px; height: 1779px;">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanelOfMonthPage" runat="server">
        <ContentTemplate>
            <asp:ObjectDataSource ID="MonthlyDataSourceFromTable" runat="server" DeleteMethod="Delete"
                InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByMonth"
                TypeName="JsonServer.FYPDataSetTableAdapters.FYPPowerTableTableAdapter" UpdateMethod="Update">
                <DeleteParameters>
                    <asp:Parameter Name="Original_Id" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="Power" Type="String" />
                    <asp:Parameter Name="CreateDate" Type="String" />
                </InsertParameters>
                <SelectParameters>
                    <asp:ControlParameter ControlID="TextBoxOfMonthPageYear" Name="YEAR" PropertyName="Text"
                        Type="String" />
                    <asp:ControlParameter ControlID="TextBoxOfMonthPageMonth" Name="MONTH" PropertyName="Text"
                        Type="String" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Power" Type="String" />
                    <asp:Parameter Name="CreateDate" Type="String" />
                    <asp:Parameter Name="Original_Id" Type="Int32" />
                </UpdateParameters>
            </asp:ObjectDataSource>
            <br />
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Year:
            <asp:TextBox ID="TextBoxOfMonthPageYear" runat="server" MaxLength="4"></asp:TextBox>
            <br />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBoxOfMonthPageYear"
                ErrorMessage="Please input year value">*</asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBoxOfMonthPageYear"
                ErrorMessage="Invalid year value" ValidationExpression="\d{4}$">*</asp:RegularExpressionValidator>
            <br />
            <br />
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Month:
            <asp:TextBox ID="TextBoxOfMonthPageMonth" runat="server" MaxLength="2"></asp:TextBox>
            <br />
            <asp:Button ID="ButtonCalculateMonthPower" runat="server" OnClick="ButtonCalculateMonthPower_Click"
                Text="Calculate" Style="z-index: 1; left: 40px; top: 215px; position: absolute;
                width: 235px; height: 50px;" />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBoxOfMonthPageMonth"
                ErrorMessage="Please input month value">*</asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TextBoxOfMonthPageMonth"
                ErrorMessage="Invalid month value" ValidationExpression="\d{2}$">*</asp:RegularExpressionValidator>
       
            <div> 
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" /><br>
                <br></br>
                <br></br>
                <asp:Label ID="LabelMonthPower" runat="server" Style="z-index: 1; left: 27px; top: 326px;
                position: absolute"></asp:Label>
                <br>
                <br></br>
                <br></br>
                <asp:Label ID="LabelElectricFee" runat="server" Style="z-index: 1; left: 26px; top: 365px;
                position: absolute"></asp:Label>
                <br>
                <br></br>
                <br></br>
                <asp:Label ID="LabelCarbonEmissions" runat="server" Style="z-index: 1; left: 26px; top: 345px;
                position: absolute; height: 36px;"></asp:Label>
                <br>
                <br></br>
                <br></br>
                </br>
                </br>
                </br>
                </br>
            </div>
            <asp:Chart ID="Chart1" runat="server" DataSourceID="MonthlyDataSourceFromTable" Style="z-index: 1;
                left: 20px; top: 420px; position: absolute;" Height="294px" Width="289px">
                <Series>
                    <asp:Series ChartType="Spline" Name="Series1" XValueMember="CreateDate" YValueMembers="Power">
                    </asp:Series>
                </Series>
                <ChartAreas>
                    <asp:ChartArea Name="ChartArea1">
                    </asp:ChartArea>
                </ChartAreas>
            </asp:Chart>
            <br />
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="MonthlyDataSourceFromTable"
                PageSize="30" CellPadding="4" ForeColor="#333333" GridLines="None" Width="250px"
                Style="z-index: 1; left: 41px; top: 800px; position: absolute; height: 774px;
                width: 250px">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" ReadOnly="True" />
                    <asp:BoundField DataField="Power" HeaderText="Power" SortExpression="Power" />
                    <asp:BoundField DataField="CreateDate" HeaderText="CreateDate" SortExpression="CreateDate" />
                </Columns>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#EFF3FB" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>
